module AboutYou
  module SDK
    module Model
      ###
      # This class represents a Price Range model.
      #
      # author:: Collins GmbH & Co KG
      ###
      class PriceRange
        # the product count
        attr_accessor :product_count
        # startpoint of the price range
        attr_accessor :from
        # end of the price range
        attr_accessor :to
        # min value of the price range
        attr_accessor :min
        # max value of the price range
        attr_accessor :max
        # mean
        attr_accessor :mean
        # sum
        attr_accessor :sum

        ###
        # This method is used for creating an instance of this class by a json_object.
        #
        # * *Args*    :
        #   - +json_object+ -> the jsonObject received from the api
        #
        # * *Returns* :
        #   - Instance of AboutYou::SDK::Model::PriceRange
        ###
        def self.create_from_json(json_object)
          price_range = new

          price_range.product_count = json_object['count']
          price_range.from = json_object['from']
          price_range.to = json_object['to']
          price_range.min = json_object['min']
          price_range.max = json_object['max']
          price_range.mean = json_object['mean']
          price_range.sum = json_object['total']

          price_range
        end
      end
    end
  end
end
